<?php
use think\facade\Route;

// menu相关
Route::group("v1/admin", function () {
    // 添加栏目
    Route::group(function () {
        Route::post('addMenu', 'addMenu');
    })->prefix('\app\admin\controller\v1\Menu@');
    // 获取所有栏目
    Route::group(function () {
        Route::get('getMenu', 'getMenu');
    })->prefix('\app\admin\controller\v1\Menu@');
    // 获取所有栏目列表
    Route::group(function () {
        Route::post('getMenuList', 'getMenuList');
    })->prefix('\app\admin\controller\v1\Menu@');
    // 删除栏目
    Route::group(function () {
        Route::delete('deleteMenu/id/:id', 'deleteMenu')
        ->pattern(['id'=>'\d+']);
    })->prefix('\app\admin\controller\v1\Menu@');
    // 更新栏目
    Route::group(function () {
        Route::put('updateMenu', 'updateMenu')
            ->pattern(['id'=>'\d+']);
    })->prefix('\app\admin\controller\v1\Menu@');
    // 更新ID更新状态
    Route::group(function () {
        Route::put('updateMenuStatusById', 'updateMenuStatusById');
    })->prefix('\app\admin\controller\v1\Menu@');
});

// Category
Route::group("v1/admin", function () {
    // 添加Category
    Route::group(function () {
        Route::post('addCategory', 'addCategory');
    })->prefix('\app\admin\controller\v1\Category@');
    // 后台查看所以的Category
    Route::group(function () {
        Route::get('getAllCategoryPage', 'getAllCategoryPage');
    })->prefix('\app\admin\controller\v1\Category@');
    // 获取所有状态为启动的Category
    Route::group(function () {
        Route::get('getAllCategory', 'getAllCategory');
    })->prefix('\app\admin\controller\v1\Category@');
    // 更新
    Route::group(function () {
        Route::put('updateCategory', 'updateCategory');
    })->prefix('\app\admin\controller\v1\Category@');
    // 删除
    Route::group(function () {
        Route::delete('deleteCategory/id/:id', 'deleteCategory');
    })->prefix('\app\admin\controller\v1\Category@');
});

// Tag
Route::group("v1/admin", function () {
    // 添加Category
    Route::group(function () {
        Route::post('addTag', 'addTag');
    })->prefix('\app\admin\controller\v1\Tag@');
    // 后台查看所有的Category分页
    Route::group(function () {
        Route::get('getAllTag', 'getAllTag');
    })->prefix('\app\admin\controller\v1\Tag@');
    // 后台查看所有的Category
    Route::group(function () {
        Route::get('getTags', 'getTags');
    })->prefix('\app\admin\controller\v1\Tag@');
    // 更新
    Route::group(function () {
        Route::put('updateTag', 'updateTag');
    })->prefix('\app\admin\controller\v1\Tag@');
    // 删除
    Route::group(function () {
        Route::delete('deleteTag/id/:id', 'deleteTag');
    })->prefix('\app\admin\controller\v1\Tag@');
});

// Article
Route::group("v1/admin", function () {
    // 添加文章
    Route::group(function () {
        Route::post('addArticle', 'addArticle');
    })->prefix('\app\admin\controller\v1\Article@');
    // 查看文章
    Route::group(function () {
        Route::post('getAllArticle', 'getAllArticle');
    })->prefix('\app\admin\controller\v1\Article@');
    // 删除文章
    Route::group(function () {
        Route::get('deleteArticle/id/:id', 'deleteArticle');
    })->prefix('\app\admin\controller\v1\Article@');
    // 获取文章详情
    Route::group(function () {
        Route::get('getArticle/id/:id', 'getArticle');
    })->prefix('\app\admin\controller\v1\Article@');
    // 更新文章
    Route::group(function () {
        Route::put('updateArticle', 'updateArticle');
    })->prefix('\app\admin\controller\v1\Article@');
    // 更新文章状态
    Route::group(function () {
        Route::put('updateArticleStatus', 'updateArticleStatus');
    })->prefix('\app\admin\controller\v1\Article@');
});

// BlogSetting
Route::group("v1/admin", function () {
    // 获取配置
    Route::group(function () {
        Route::get('getBlogSetting', 'getBlogSetting');
    })->prefix('\app\admin\controller\v1\BlogSetting@');
    // 更新设置
    Route::group(function () {
        Route::put('saveBlogSetting', 'saveBlogSetting');
    })->prefix('\app\admin\controller\v1\BlogSetting@');
    // 博主简介
    Route::group(function () {
        Route::put('updateBloggerInfo', 'updateBloggerInfo');
    })->prefix('\app\admin\controller\v1\BlogSetting@');
    // 获取博主信息
    Route::group(function () {
        Route::get('getBloggerInfo', 'getBloggerInfo');
    })->prefix('\app\admin\controller\v1\BlogSetting@');
});

// 友情链接
Route::group("v1/admin", function () {
    // 添加友情链接
    Route::group(function () {
        Route::post('addShareUrl', 'addShareUrl');
    })->prefix('\app\admin\controller\v1\ShareUrl@');
    // 更新友情链接
    Route::group(function () {
        Route::put('updateShareUrl', 'updateShareUrl');
    })->prefix('\app\admin\controller\v1\ShareUrl@');
    // 获取友情链接
    Route::group(function () {
        Route::post('getShareUrlList', 'getShareUrlList');
    })->prefix('\app\admin\controller\v1\ShareUrl@');
    // 根据ID更新对应的状态
    Route::group(function () {
        Route::put('updateShareUrlStatus', 'updateShareUrlStatus');
    })->prefix('\app\admin\controller\v1\ShareUrl@');
    // 根据ID删除
    Route::group(function () {
        Route::delete('deleteShareUrl', 'deleteShareUrl');
    })->prefix('\app\admin\controller\v1\ShareUrl@');
    // 根据ID获取
    Route::group(function () {
        Route::get('getShareUrlById', 'getShareUrlById');
    })->prefix('\app\admin\controller\v1\ShareUrl@');
});

// 广告
Route::group("v1/admin", function () {
    // 添加广告
    Route::group(function () {
        Route::post('addAd', 'addAd');
    })->prefix('\app\admin\controller\v1\Ad@');
    // 更新广告
    Route::group(function () {
        Route::put('updateAd', 'updateAd');
    })->prefix('\app\admin\controller\v1\Ad@');
    // 获取广告
    Route::group(function () {
        Route::post('getAdList', 'getAdList');
    })->prefix('\app\admin\controller\v1\Ad@');
    // 根据ID更新对应的广告状态
    Route::group(function () {
        Route::put('updateAdStatusBydId', 'updateAdStatusBydId');
    })->prefix('\app\admin\controller\v1\Ad@');
    // 根据ID删除广告
    Route::group(function () {
        Route::delete('deleteAdById', 'deleteAdById');
    })->prefix('\app\admin\controller\v1\Ad@');
    // 根据ID获取广告
    Route::group(function () {
        Route::get('getAdById', 'getAdById');
    })->prefix('\app\admin\controller\v1\Ad@');
});

// 留言
Route::group("v1/admin", function () {
    // 留言列表
    Route::group(function () {
        Route::post('messageList', 'messageList');
    })->prefix('\app\admin\controller\v1\Message@');
    // 留言列表
    Route::group(function () {
        Route::post('blogMessageList', 'blogMessageList');
    })->prefix('\app\admin\controller\v1\Message@');
    // 审核留言
    Route::group(function () {
        Route::put('updateMessageStatus', 'updateMessageStatus');
    })->prefix('\app\admin\controller\v1\Message@');
    // 回复留言
    Route::group(function () {
        Route::post('answerMessage', 'answerMessage');
    })->prefix('\app\admin\controller\v1\Message@');
    // 删除留言
    Route::group(function () {
        Route::delete('deleteMessage', 'deleteMessage');
    })->prefix('\app\admin\controller\v1\Message@');
});

// Task
Route::group("v1/admin", function () {
    // 留言列表
    Route::group(function () {
        Route::get('cleanAdAndArticleTodayClickNum', 'cleanAdAndArticleTodayClickNum');
    })->prefix('\app\admin\controller\v1\TimeTask@');
});

// 统计
Route::group("v1/admin", function () {
    // 获取统计列表
    Route::group(function () {
        Route::get('getStatisticsList', 'getStatisticsList');
    })->prefix('\app\admin\controller\v1\Statistics@');
    // 根据id获取当天文章统计
    Route::group(function () {
        Route::post('articleStatisticsDetails', 'articleStatisticsDetails');
    })->prefix('\app\admin\controller\v1\Statistics@');
    // 根据id获取当天广告统计
    Route::group(function () {
        Route::post('adStatisticsDetails', 'adStatisticsDetails');
    })->prefix('\app\admin\controller\v1\Statistics@');
    // 获取今天文章统计
    Route::group(function () {
        Route::post('todayArticleStatisticsDetails', 'todayArticleStatisticsDetails');
    })->prefix('\app\admin\controller\v1\Statistics@');
    // 获取今天广告统计
    Route::group(function () {
        Route::post('todayAdStatisticsDetails', 'todayAdStatisticsDetails');
    })->prefix('\app\admin\controller\v1\Statistics@');
});